import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/application/basic_information/file_statistics_entity.dart';

FileStatisticsEntity $FileStatisticsEntityFromJson(Map<String, dynamic> json) {
  final FileStatisticsEntity fileStatisticsEntity = FileStatisticsEntity();
  final FileStatisticsCertificate? certificate = jsonConvert.convert<FileStatisticsCertificate>(json['certificate']);
  if (certificate != null) {
    fileStatisticsEntity.certificate = certificate;
  }
  final FileStatisticsCompliance? compliance = jsonConvert.convert<FileStatisticsCompliance>(json['compliance']);
  if (compliance != null) {
    fileStatisticsEntity.compliance = compliance;
  }
  final FileStatisticsProjectSame? projectSame = jsonConvert.convert<FileStatisticsProjectSame>(json['projectSame']);
  if (projectSame != null) {
    fileStatisticsEntity.projectSame = projectSame;
  }
  return fileStatisticsEntity;
}

Map<String, dynamic> $FileStatisticsEntityToJson(FileStatisticsEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['certificate'] = entity.certificate?.toJson();
  data['compliance'] = entity.compliance?.toJson();
  data['projectSame'] = entity.projectSame?.toJson();
  return data;
}

extension FileStatisticsEntityExtension on FileStatisticsEntity {
  FileStatisticsEntity copyWith({
    FileStatisticsCertificate? certificate,
    FileStatisticsCompliance? compliance,
    FileStatisticsProjectSame? projectSame,
  }) {
    return FileStatisticsEntity()
      ..certificate = certificate ?? this.certificate
      ..compliance = compliance ?? this.compliance
      ..projectSame = projectSame ?? this.projectSame;
  }
}

FileStatisticsCertificate $FileStatisticsCertificateFromJson(Map<String, dynamic> json) {
  final FileStatisticsCertificate fileStatisticsCertificate = FileStatisticsCertificate();
  final int? dueNum = jsonConvert.convert<int>(json['dueNum']);
  if (dueNum != null) {
    fileStatisticsCertificate.dueNum = dueNum;
  }
  final int? expirationNum = jsonConvert.convert<int>(json['expirationNum']);
  if (expirationNum != null) {
    fileStatisticsCertificate.expirationNum = expirationNum;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    fileStatisticsCertificate.id = id;
  }
  final int? normalNum = jsonConvert.convert<int>(json['normalNum']);
  if (normalNum != null) {
    fileStatisticsCertificate.normalNum = normalNum;
  }
  return fileStatisticsCertificate;
}

Map<String, dynamic> $FileStatisticsCertificateToJson(FileStatisticsCertificate entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['dueNum'] = entity.dueNum;
  data['expirationNum'] = entity.expirationNum;
  data['id'] = entity.id;
  data['normalNum'] = entity.normalNum;
  return data;
}

extension FileStatisticsCertificateExtension on FileStatisticsCertificate {
  FileStatisticsCertificate copyWith({
    int? dueNum,
    int? expirationNum,
    String? id,
    int? normalNum,
  }) {
    return FileStatisticsCertificate()
      ..dueNum = dueNum ?? this.dueNum
      ..expirationNum = expirationNum ?? this.expirationNum
      ..id = id ?? this.id
      ..normalNum = normalNum ?? this.normalNum;
  }
}

FileStatisticsCompliance $FileStatisticsComplianceFromJson(Map<String, dynamic> json) {
  final FileStatisticsCompliance fileStatisticsCompliance = FileStatisticsCompliance();
  final int? dueNum = jsonConvert.convert<int>(json['dueNum']);
  if (dueNum != null) {
    fileStatisticsCompliance.dueNum = dueNum;
  }
  final int? expirationNum = jsonConvert.convert<int>(json['expirationNum']);
  if (expirationNum != null) {
    fileStatisticsCompliance.expirationNum = expirationNum;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    fileStatisticsCompliance.id = id;
  }
  final int? normalNum = jsonConvert.convert<int>(json['normalNum']);
  if (normalNum != null) {
    fileStatisticsCompliance.normalNum = normalNum;
  }
  return fileStatisticsCompliance;
}

Map<String, dynamic> $FileStatisticsComplianceToJson(FileStatisticsCompliance entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['dueNum'] = entity.dueNum;
  data['expirationNum'] = entity.expirationNum;
  data['id'] = entity.id;
  data['normalNum'] = entity.normalNum;
  return data;
}

extension FileStatisticsComplianceExtension on FileStatisticsCompliance {
  FileStatisticsCompliance copyWith({
    int? dueNum,
    int? expirationNum,
    String? id,
    int? normalNum,
  }) {
    return FileStatisticsCompliance()
      ..dueNum = dueNum ?? this.dueNum
      ..expirationNum = expirationNum ?? this.expirationNum
      ..id = id ?? this.id
      ..normalNum = normalNum ?? this.normalNum;
  }
}

FileStatisticsProjectSame $FileStatisticsProjectSameFromJson(Map<String, dynamic> json) {
  final FileStatisticsProjectSame fileStatisticsProjectSame = FileStatisticsProjectSame();
  final int? cancel = jsonConvert.convert<int>(json['cancel']);
  if (cancel != null) {
    fileStatisticsProjectSame.cancel = cancel;
  }
  final int? construction = jsonConvert.convert<int>(json['construction']);
  if (construction != null) {
    fileStatisticsProjectSame.construction = construction;
  }
  final int? design = jsonConvert.convert<int>(json['design']);
  if (design != null) {
    fileStatisticsProjectSame.design = design;
  }
  final int? trialProduction = jsonConvert.convert<int>(json['trialProduction']);
  if (trialProduction != null) {
    fileStatisticsProjectSame.trialProduction = trialProduction;
  }
  return fileStatisticsProjectSame;
}

Map<String, dynamic> $FileStatisticsProjectSameToJson(FileStatisticsProjectSame entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['cancel'] = entity.cancel;
  data['construction'] = entity.construction;
  data['design'] = entity.design;
  data['trialProduction'] = entity.trialProduction;
  return data;
}

extension FileStatisticsProjectSameExtension on FileStatisticsProjectSame {
  FileStatisticsProjectSame copyWith({
    int? cancel,
    int? construction,
    int? design,
    int? trialProduction,
  }) {
    return FileStatisticsProjectSame()
      ..cancel = cancel ?? this.cancel
      ..construction = construction ?? this.construction
      ..design = design ?? this.design
      ..trialProduction = trialProduction ?? this.trialProduction;
  }
}
